package shuati.jd2023;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

/**
 * @author : LdLtd
 * @Date : 2023/10/28
 * @Description:
 */
public class jd01 {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        List<String> res= new ArrayList<>();
        int t=sc.nextInt();
        sc.nextLine();
        char [][]g=new char[3][3];
        for (int i = 0; i < t; i++) {

            for (int j = 0; j < 3; j++) {
                String row=sc.nextLine();
                for (int k = 0; k < 3; k++) {
                    g[j][k]=row.charAt(k);
                }
            }
            System.out.println(winwin(g));
        }
    }
    public static String winwin(char [][] g){
        boolean kou = false,yukari=false;
        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 3; j++) {
                if(g[i][j]=='.') continue;
                else {
                    //判断列
                    if(i-1>=0&&i+1<3){
                        //和领行不相等，且邻行不是空
                        if(g[i][j]!=g[i-1][j]&&g[i-1][j]==g[i+1][j]&&g[i-1][j]!='.'){
                            if(g[i][j]=='o')  kou=true;
                            else yukari=true;
                        }
                    }
                    //判断行
                    if(j-1>=0&&j+1<3){
                        //和领行不相等，且邻行不是空
                        if(g[i][j]!=g[i][j-1]&&g[i][j-1]==g[i][j+1]&&g[i][j-1]!='.'){
                            if(g[i][j]=='o')  kou=true;
                            else yukari=true;
                        }
                    }

                }
            }
        }
        if(kou&&yukari) return "draw";
        else if(kou) return "kou";
        else return "yukari";
    }
}
